package com.hao.epidemic_prevention.service;

import com.hao.epidemic_prevention.bean.Admin;
import com.hao.epidemic_prevention.dao.AdminMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class AdminService {

    @Autowired
    private AdminMapper adminMapper;

    // 根据用户名获取admin
    public Admin login(String username) {
        return adminMapper.getAdminByUsername(username);
    }

    // 根据用户名获取admin
    public Admin loginWithPassword(Admin admin) {
        //admin.setPassword(new MyPasswordEncoder().encode(admin.getPassword()));
        return adminMapper.getAdminByUsernameAndPassword(admin);
    }

}
